﻿Imports System.Data
Imports System.Data.SqlClient
Imports BE = Entidades
Imports LogicDAO
Public Class UsuarioDAO
    Dim conexion As SqlConnection
    Dim cn As New Conexion
    Dim comando As SqlDataAdapter
    Public Shared errores As String
    Dim cmd As SqlCommand

    ''Public Function getUsuario(ByVal objEmpBC As BE.Cliente) As String
    'Dim cn As New Conexion
    'Dim msg As String = ""

    '    Try
    '        conexion = cn.Conectar

    'Dim cmd As New SqlCommand("usp_UsuarioIngresa", conexion)
    '        cmd.CommandType = CommandType.StoredProcedure

    '        cmd.Parameters.Add(New SqlParameter("@log", SqlDbType.Char, 6))
    '        cmd.Parameters.Add(New SqlParameter("@pass", SqlDbType.Char, 6))

    '        cmd.Parameters("@log").Direction = ParameterDirection.Input
    '        cmd.Parameters("@pass").Direction = ParameterDirection.Input

    '        cmd.Parameters("@log").Value = objEmpBC.Email
    '        cmd.Parameters("@pass").Value = objEmpBC.Password

    '        conexion.Open()
    '        cmd.ExecuteNonQuery()
    '        msg = "Usuario Correcto!!"
    '    Catch ex As Exception
    '        msg = ex.Message
    '    Finally
    '        conexion.Close()
    '    End Try


    '    Return msg
    'End Function





    Private objCn As New Conexion


    Public Function getUsuario(ByVal log As String, ByVal pass As String) As DataTable
        conexion = cn.Conectar


        Dim da As New SqlDataAdapter("select * from tb_Usuario " _
                                     + " where log_user='" + log + "' and pass_user='" + pass + "'", conexion)
        Dim dt As New DataTable
        da.Fill(dt)
        Return dt
    End Function
End Class
